package cn.lili.modules.member.client;

import cn.lili.modules.constant.ServiceConstant;
import cn.lili.modules.member.entity.dos.User;
import cn.lili.modules.member.fallback.VipFallback;
import cn.lili.modules.system.entity.dos.LiVip;
import cn.lili.modules.system.entity.dos.LiVipConfig;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * 用户服务client
 *
 * @author liushuai(liushuai711 @ gmail.com)
 * @since 2021/12/7 08:23
 */
@FeignClient(path = "${server.servlet.context-path}", name = ServiceConstant.USER_SERVICE, contextId = "vip", fallback = VipFallback.class)
public interface VipClient {

    /**
     * 查询用户会员
     *
     * @param userId 用户id
     * @return 用户
     */
    @GetMapping("/feign/vip/query")
    LiVip getByUserId(@RequestParam("userId") String userId);

    @PostMapping("/feign/vip/update")
    boolean update(@RequestBody LiVip liVip);

    @PostMapping("/feign/vip/save")
    boolean save(@RequestBody LiVip liVip);

    @GetMapping("/feign/vip/saveVipFlow")
    void saveVipFlow (@RequestParam("payerId") String payerId, @RequestParam("paymentMethod") String paymentMethod, @RequestParam("price") Double price);
}
